{% extends "layout.twig" %}

{% block body %}
    <div class="login">
        <svg class="nextcloud-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 142 100" width="142" height="100">
            <use href="/img/nextcloud-logo.svg#logo"></use>
            <use href="/img/nextcloud-logo.svg#Nextcloud"></use>
            <text x="10" y="50" fill="var(--color-nextcloud-logo)" class="fallback-text">Nextcloud Logo</text>
        </svg>
        <h1>Nextcloud AIO Login</h1>
        {% if is_login_allowed == true %}
            <p>Log in using your Nextcloud AIO passphrase:</p>
            <form method="POST" action="/api/auth/login" class="xhr">
                <input type="password" autocomplete="current-password" name="password" placeholder="Password" id="master-password" oninput="showPassword('master-password')">
                <input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
                <input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
                <input type="submit" class="button" value="Log in" />
            </form>
        {% else %}
            <p>The login is blocked since Nextcloud is running.<br>Please use the <a href="https://github.com/nextcloud/all-in-one#how-to-easily-log-in-to-the-aio-interface"><strong>automatic login</strong></a> from your Nextcloud.<br><br>
            If that is not possible, you can unblock the login by running<br><strong>sudo docker stop nextcloud-aio-apache</strong></p>
        {% endif %}
    </div>
    <script type="text/javascript" src="before-unload.js"></script>
{% endblock %}
